<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="umsroot.css">
<TITLE>
Introduction
</TITLE>
</HEAD>
<BODY >
<A HREF="umsroot049.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot051.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc127">9.1</A>&nbsp;&nbsp;Introduction</H2>

This chapter describes primitives that allow to break the normal logic
programming rules in two ways:
<UL CLASS="itemize"><LI CLASS="li-itemize">
information can be <B>saved across logical failures</B> and backtracking
<LI CLASS="li-itemize">information can be accessed by <B>naming</B> rather than by argument passing
</UL>
Obviously, these facilities must be used with care and should always
be encapsulated in an interface that provides logical semantics.<BR>
<BR>
ECLiPSe provides several facilities to store information across
backtracking. The following table gives an overview. If at all
possible, the handle-based facilities (bags, shelves and stores) should be
preferred because they lead to cleaner, reentrant code (without global
state) and reduce the risk of memory leaks. <BR>
<BR>
<BR>

<DIV CLASS="center">
<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1>
<TR><TD ALIGN=left NOWRAP>Facility</TD>
<TD ALIGN=left NOWRAP>Type</TD>
<TD ALIGN=left NOWRAP>Access</TD>
<TD ALIGN=left NOWRAP>See</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>shelves</TD>
<TD ALIGN=left NOWRAP>array</TD>
<TD ALIGN=left NOWRAP>by handle</TD>
<TD ALIGN=left NOWRAP>shelf_create/2,3</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>bags</TD>
<TD ALIGN=left NOWRAP>unordered bag</TD>
<TD ALIGN=left NOWRAP>by handle</TD>
<TD ALIGN=left NOWRAP>bag_create/1</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>stores</TD>
<TD ALIGN=left NOWRAP>hash table</TD>
<TD ALIGN=left NOWRAP>by handle</TD>
<TD ALIGN=left NOWRAP>store_create/1</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>named shelves</TD>
<TD ALIGN=left NOWRAP>array</TD>
<TD ALIGN=left NOWRAP>by name</TD>
<TD ALIGN=left NOWRAP>shelf/2</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>named stores</TD>
<TD ALIGN=left NOWRAP>hash table</TD>
<TD ALIGN=left NOWRAP>by name</TD>
<TD ALIGN=left NOWRAP>store/1</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>non-logical variables</TD>
<TD ALIGN=left NOWRAP>single cell</TD>
<TD ALIGN=left NOWRAP>by name</TD>
<TD ALIGN=left NOWRAP>variable/1</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>non-logical arrays</TD>
<TD ALIGN=left NOWRAP>array</TD>
<TD ALIGN=left NOWRAP>by name</TD>
<TD ALIGN=left NOWRAP>array/1,2</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>records</TD>
<TD ALIGN=left NOWRAP>ordered list</TD>
<TD ALIGN=left NOWRAP>by name</TD>
<TD ALIGN=left NOWRAP>record/1,2</TD>
</TR>
<TR><TD ALIGN=left NOWRAP>dynamic predicates</TD>
<TD ALIGN=left NOWRAP>ordered list</TD>
<TD ALIGN=left NOWRAP>by name</TD>
<TD ALIGN=left NOWRAP>dynamic/1,assert/1</TD>
</TR></TABLE>
</DIV>
<BR>
<BR>
<BR>
<A NAME="@default439"></A>
<A NAME="@default440"></A>
The other facility described here, <B>Global References</B>, does not store
information across failure, but provides a means to give a name to
an otherwise logical data structure. See section <A HREF="umsroot056.html#globrefs">9.7</A>.<BR>
<BR>
<HR>
<A HREF="umsroot049.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot051.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
